﻿@using PagedList.Mvc
@model PagedList.IPagedList<NC.Data.Post>
<div class="media">
    <div class="media-body">
        @foreach (var post in Model)
        {
            <a href="@Url.Action("SinglePost", new {postId = post.Id})" class="NCpostDiaplay">
                <p>
                    <span class="spanbegins">
                        <strong>@post.CreatorName: </strong>
                    </span>
                    <span>@NC.Helper.Truncate(@post.Description, 30)</span>
                </p>
                <span class="font">@post.PostDate.ToString("dd MMM yyyy")</span> <span class="media-heading cat">in @post.Category.CategoryName</span>
                <p><span style="padding-right: 25px;">@post.Address.State.StateName,@post.Address.Country.CountryName</span></p>
            </a>
        }
    </div>
</div>

@if (Model.Count > 0)
{
    <div id="contentpager">
        @Html.PagedListPager(Model, page => Url.Action("ViewAvailablePosts", new { page }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(PagedListRenderOptions.OnlyShowFivePagesAtATime, new AjaxOptions() { HttpMethod = "GET", UpdateTargetId = "availableposts" }))
    </div>
}
else
{
    <div>
        No results found.
    </div>
}
